package interrupt.join;

public class Child extends Thread{

    @Override
    public void run(){
        System.out.println("Child start");
        while (!Thread.currentThread().isInterrupted()) {
            try {
                System.out.println("Child is waiting, alive: " + Thread.activeCount());
                Thread.sleep(500);
            } catch (InterruptedException e) {
                System.out.println("Child throw InterruptedException: " + Thread.currentThread().isInterrupted());
                Thread.currentThread().interrupt();
            }
        }
        System.out.println("Child end");
    }
}
